package com.my.commonlibrary.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.ImageView;

import com.my.commonlibrary.R;

/**
 * Author : Cooper
 * Time : 2016/10/19  11:43
 * Description : 启动页
 */

public class SplashActivity extends Activity {

    private ImageView mSplashIv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.aty_splash_layout);
        int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
        getWindow().setFlags(flag,flag);
        initView();
    }

    private void initView() {
        mSplashIv = (ImageView) findViewById(R.id.img_splash_iv);
        Animation animation = new AlphaAnimation(0.5f,1.0f);
        animation.setDuration(2000);
        mSplashIv.setAnimation(animation);
        animation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                startActivity(new Intent(SplashActivity.this,HomeDrawerLayoutActivity.class));
                SplashActivity.this.finish();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }
}
